package com.cskaoyan.bean.wx_coupon;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

/**
 * @author: Jason 805636901@qq.com
 * @create: 2021-10-22-10:38 AM
 */
@Data
public class WxCouponPageData<T> {

    Integer limit;
    Integer page;
    Integer pages;
    Integer total;
    List<T> list;

    public static <T> WxCouponPageData ok(List<T> pageData) {
        PageInfo<T> wxCouponPageInfo = new PageInfo<>();
        WxCouponPageData<T> data = new WxCouponPageData<>();
        data.setPage(wxCouponPageInfo.getPageNum());
        data.setLimit(wxCouponPageInfo.getPageSize());
        data.setPages(wxCouponPageInfo.getPages());
        data.setTotal((int) wxCouponPageInfo.getTotal());
        data.setList(pageData);
        return data;
    }

}
